//
//  CHVisitorView.swift
//  Weibo
//
//  Created by charmer on 16/9/25.
//  Copyright © 2016年 charmer. All rights reserved.
//

import UIKit

class CHVisitorView: UIView {

    //OC initWithCoder：，使用storyboard 或 xib 的时候回调
    //required表示必须的
    //当我们实现init（frame：CGRect）就不会继承父类的构造函数，就缺少了init？（coder aDecoder：NSCoder）
//    required init(coder aDecoder: NSCoder) {
//        fatalError("init(coder:) has not been implemented")
//    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor.blue
        self.setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    private func setupUI() {
        //添加子控件
        self.addSubview(iconImgView)
        self.addSubview(houseImgView)
        self.addSubview(messageLabel)
        self.addSubview(registerButton)
        self.addSubview(loginButton)
    }
    
    //懒加载转圈视图
    private lazy var iconImgView: UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_smallicon"))
    
    //懒加载房子
    private lazy var houseImgView: UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_house"))
    
    //懒加载label
    private lazy var messageLabel: UILabel = {
        let label = UILabel()
        label.font = UIFont.systemFont(ofSize: 16)
        label.textColor = UIColor.darkGray
        label.text = "关注一些人，看看有什么惊喜！关注一些人，看看有什么惊喜！关注一些人，看看有什么惊喜！关注一些人，看看有什么惊喜！关注一些人，看看有什么惊喜！"
        label.numberOfLines = 0
    
        return label
    }()
    
    //懒加载注册按钮
    private lazy var registerButton: UIButton = {
        let button = UIButton()
        //设置按钮
        button.setImage(UIImage(named: "common_button_white_disable"), for: .normal)
        button.setTitle("注册", for: .normal)
        button.setTitleColor(UIColor.orange, for: .normal)
        
        return button
    }()
    
    //懒加载登录按钮
    private lazy var loginButton: UIButton = {
        let button = UIButton()
        button.setImage(UIImage(named: "common_button_white_disable"), for: .normal)
        button.setTitle("登录", for: .normal)
        button.setTitleColor(UIColor.darkGray, for: .normal)
        
        return button
    }()

}
